/**
 * Copyright ©2012-2018 HopeHaiyang Corporation, All Rights Reserved
 * http://www.wuhanhope.com
 */
package hope.platform.data.web;

import hope.platform.data.domain.SiteDistance;
import hope.platform.data.server.data.header.SiteDistanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * class info
 *
 * @author hujia
 *         Create at 2018/7/16 9:36
 */
@RequestMapping("/siteDistance")
@RestController
public class SiteDistanceController {

    @Autowired
    private SiteDistanceService siteDistanceService;


    @RequestMapping(value = "/{serialNumber}/{down}/{up}",method = RequestMethod.GET)
    private List<SiteDistance> getBySerialNumberAndDistanceBetween(@PathVariable String serialNumber,
                                                                   @PathVariable double down,
                                                                   @PathVariable double up) throws Exception {
        return siteDistanceService.getBySerialNumberAndDistanceBetween(serialNumber, down, up);
    }

    @RequestMapping(value = "/{serialNumber}",method = RequestMethod.GET)
    private List<SiteDistance> getSiteDistancesBySerialNumber(@PathVariable String serialNumber) throws Exception {
        return siteDistanceService.getSiteDistancesBySerialNumber(serialNumber);
    }

}
